package com.vhall.component.controller.pay.facade;

import com.vhall.component.entity.pay.vo.PaymentParamVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.Map;

/**
 * @author lsl
 * @since 2021/7/5
 */
@FeignClient(value = "PaymentFacade", path = "/v4/pay")
public interface PaymentFacade {

    /**
     * 交易信息存入缓存    该方法只在测试环境试验
     *
     * @param data
     * @return
     */
    @PostMapping("/trade-cache-set")
    Boolean tradeNoInsertCache(Map<String, Object> data);

    /**
     * 获取交易信息缓存  该方法只在测试环境试验
     *
     * @param tradeNo trade no
     * @return trade no with no cache
     */
    @GetMapping("/trade-cache-get")
    Map<String, Object> getTradeNoCache(@RequestParam("trade_no") String tradeNo);

    /**
     * 生成支付所需参数
     *
     * @param reqVO 请求参数
     * @return 支付参数
     */
    @PostMapping("/gen-payment")
    Object genPayment(@Validated PaymentParamVO reqVO);
}
